﻿<UserControl x:Class="RK.Wpf3DSampleBrowser.Samples.WpfSimpleCube.WpfSimpleCubeControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Viewport3D Name="m_viewport3D" >
            
            <!-- Define the viewport's camera -->
            <Viewport3D.Camera>
                <PerspectiveCamera 
                    Position="-3,3,-3"
                    LookDirection="1,-1,1"
                    UpDirection="0,1,0"
                    FieldOfView="45" 
                    NearPlaneDistance="1"
                    FarPlaneDistance="100"/>
            </Viewport3D.Camera>

            <!-- Define ambient light -->
            <ModelUIElement3D>
                <AmbientLight Color="White" />
            </ModelUIElement3D>
            
            <!-- Define directional light-->
            <ModelUIElement3D>
                <DirectionalLight Direction="3 -.3 5" Color="White" />
            </ModelUIElement3D>

            <!-- Define the 3D model -->
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <Model3DGroup>
                        <Model3DGroup.Children>
                            <GeometryModel3D>
                                <GeometryModel3D.Geometry>
                                    <MeshGeometry3D Positions="-0.5,-0.5,-0.5 0.5,-0.5,-0.5 0.5,0.5,-0.5 -0.5,0.5,-0.5 0.5,-0.5,-0.5 0.5,-0.5,0.5 0.5,0.5,0.5 0.5,0.5,-0.5 0.5,-0.5,0.5 -0.5,-0.5,0.5 -0.5,0.5,0.5 0.5,0.5,0.5 -0.5,-0.5,0.5 -0.5,-0.5,-0.5 -0.5,0.5,-0.5 -0.5,0.5,0.5 -0.5,0.5,-0.5 0.5,0.5,-0.5 0.5,0.5,0.5 -0.5,0.5,0.5 -0.5,-0.5,-0.5 -0.5,-0.5,0.5 0.5,-0.5,0.5 0.5,-0.5,-0.5" 
                                                    Normals="1,0,-1 0,0,-1 0,0,-1 0,0,-1 1,0,0 1,0,0 1,0,0 1,0,0 0,0,1 0,0,1 0,0,1 0,0,1 -1,0,0 -1,0,0 -1,0,0 -1,0,0 0,1,0 0,1,0 0,1,0 0,1,0 0,-1,0 0,-1,0 0,-1,0 0,-1,0" 
                                                    TextureCoordinates="0,1 1,1 1,0 0,0 0,1 1,1 1,0 0,0 0,1 1,1 1,0 0,0 0,1 1,1 1,0 0,0 0,1 1,1 1,0 0,0 0,1 1,1 1,0 0,0" 
                                                    TriangleIndices="0 2 1 0 3 2 4 6 5 4 7 6 8 10 9 8 11 10 12 14 13 12 15 14 16 18 17 16 19 18 20 22 21 20 23 22" />
                                </GeometryModel3D.Geometry>
                                <GeometryModel3D.Material>
                                    <DiffuseMaterial AmbientColor="#FF333333" Brush="#FFFFFFFF" />
                                </GeometryModel3D.Material>
                            </GeometryModel3D>
                        </Model3DGroup.Children>
                    </Model3DGroup>
                </ModelVisual3D.Content>
            </ModelVisual3D>
        </Viewport3D>
    </Grid>
</UserControl>
